package com.paypal.android.MEP.b;

import android.content.Context;
import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.GradientDrawable.Orientation;
import android.os.Build.VERSION;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.paypal.android.MEP.PayPalActivity;
import com.paypal.android.MEP.e;
import com.paypal.android.a.g;
import com.paypal.android.a.j;

public final class h extends RelativeLayout
  implements View.OnClickListener
{
  private boolean a;
  private int b;
  private LinearLayout c;
  private LinearLayout d;
  private ImageView e;
  private ImageView f;
  private ImageView g;
  private ImageView h;
  private TextView i;
  private EditText j;
  private EditText k;
  private GradientDrawable l;

  public h(Context paramContext)
  {
    super(paramContext);
    e locale = e.a();
    setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
    setPadding(5, 5, 5, 5);
    this.c = new LinearLayout(paramContext);
    this.c.setId(5001);
    this.c.setBackgroundColor(0);
    this.c.setOrientation(0);
    this.c.setGravity(3);
    this.c.setPadding(5, 0, 5, 0);
    if (!locale.F())
    {
      this.e = g.a(paramContext, "tab-selected-email.png");
      this.e.setPadding(5, 0, 5, 0);
      this.e.setFocusable(false);
      this.c.addView(this.e);
      this.f = g.a(paramContext, "tab-unselected-email.png");
      this.f.setPadding(5, 0, 5, 0);
      this.f.setOnClickListener(this);
      this.f.setFocusable(false);
      this.c.addView(this.f);
      this.g = g.a(paramContext, "tab-selected-phone.png");
      this.g.setPadding(5, 0, 5, 0);
      this.g.setFocusable(false);
      this.c.addView(this.g);
      this.h = g.a(paramContext, "tab-unselected-phone.png");
      this.h.setPadding(5, 0, 5, 0);
      this.h.setOnClickListener(this);
      this.h.setFocusable(false);
      this.c.addView(this.h);
    }
    for (int m = -1; ; m = 0)
    {
      RelativeLayout.LayoutParams localLayoutParams1 = new RelativeLayout.LayoutParams(-1, -2);
      localLayoutParams1.addRule(10);
      localLayoutParams1.addRule(9);
      this.c.setLayoutParams(localLayoutParams1);
      this.d = new LinearLayout(paramContext);
      this.d.setId(5002);
      this.l = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -789517, -3355444 });
      this.l.setCornerRadius(5.0F);
      this.l.setStroke(1, -5197648);
      this.d.setBackgroundDrawable(this.l);
      this.d.setOrientation(1);
      this.d.setGravity(3);
      this.d.setPadding(10, 5, 10, 5);
      RelativeLayout.LayoutParams localLayoutParams2 = new RelativeLayout.LayoutParams(-1, -2);
      localLayoutParams2.addRule(5, this.c.getId());
      localLayoutParams2.addRule(3, this.c.getId());
      localLayoutParams2.setMargins(0, m, 0, 0);
      this.d.setLayoutParams(localLayoutParams2);
      this.i = new TextView(paramContext);
      this.i.setId(5003);
      this.i.setTypeface(Typeface.create("Helvetica", 1));
      this.i.setTextSize(16.0F);
      this.i.setTextColor(-16777216);
      LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, -2);
      localLayoutParams.setMargins(0, 2, 0, 2);
      this.i.setLayoutParams(localLayoutParams);
      this.d.addView(this.i);
      this.j = new EditText(paramContext);
      this.j.setId(5004);
      this.j.setLayoutParams(localLayoutParams);
      this.j.setSingleLine(true);
      this.d.addView(this.j);
      this.k = new EditText(paramContext);
      this.k.setId(5005);
      this.k.setLayoutParams(localLayoutParams);
      this.k.setSingleLine(true);
      this.d.addView(this.k);
      addView(this.c);
      addView(this.d);
      if (!Build.VERSION.SDK.equals("3"))
        bringChildToFront(this.c);
      e.a("LoginWidget", "Setup login tab, authMethod " + Integer.toString(locale.s()));
      if ((locale.s() == 1) && (locale.E()))
      {
        this.a = false;
        b(locale);
        return;
      }
      a(locale);
      return;
    }
  }

  private void a(e parame)
  {
    e.a("LoginWidget", "Setup login tab for email");
    if (!parame.F())
    {
      this.e.setVisibility(0);
      this.f.setVisibility(8);
      this.g.setVisibility(8);
      this.h.setVisibility(0);
    }
    this.a = true;
    this.i.setText(j.a("ANDROID_login_with_email_and_password") + ":");
    this.j.setVisibility(0);
    this.j.setHint(j.a("ANDROID_email_field"));
    this.j.setInputType(32);
    this.j.setText(parame.q());
    this.k.setText("");
    this.k.setHint(j.a("ANDROID_password_field"));
    this.k.setInputType(128);
    this.k.setTransformationMethod(PasswordTransformationMethod.getInstance());
    this.b = 0;
  }

  private void b(e parame)
  {
    e.a("LoginWidget", "Setup login tab for PIN");
    if (!parame.F())
    {
      this.e.setVisibility(8);
      this.f.setVisibility(0);
      this.g.setVisibility(0);
      this.h.setVisibility(8);
    }
    EditText localEditText;
    int m;
    if (this.a)
    {
      this.i.setText(j.a("ANDROID_login_with_phone_and_pin") + ":");
      localEditText = this.j;
      boolean bool = this.a;
      m = 0;
      if (!bool)
        break label228;
    }
    while (true)
    {
      localEditText.setVisibility(m);
      this.j.setHint(j.a("ANDROID_phone_field"));
      this.j.setInputType(3);
      this.j.setText(parame.r());
      this.k.setText("");
      this.k.setHint(j.a("ANDROID_pin_field"));
      this.k.setInputType(3);
      this.k.setTransformationMethod(PasswordTransformationMethod.getInstance());
      this.b = 1;
      return;
      this.i.setText(j.a("ANDROID_login_with_pin") + ":");
      break;
      label228: m = 8;
    }
  }

  public final String a()
  {
    return this.j.getText().toString().replace(" ", "");
  }

  public final String b()
  {
    return this.k.getText().toString();
  }

  public final EditText c()
  {
    return this.j;
  }

  public final EditText d()
  {
    return this.k;
  }

  public final void e()
  {
    try
    {
      ((InputMethodManager)PayPalActivity.a().getSystemService("input_method")).hideSoftInputFromWindow(this.j.getWindowToken(), 0);
      try
      {
        label24: ((InputMethodManager)PayPalActivity.a().getSystemService("input_method")).hideSoftInputFromWindow(this.k.getWindowToken(), 0);
        return;
      }
      catch (Exception localException2)
      {
      }
    }
    catch (Exception localException1)
    {
      break label24;
    }
  }

  public final void onClick(View paramView)
  {
    if (paramView == this.f)
      if (this.b != 0)
        a(e.a());
    while ((paramView != this.h) || (this.b == 1))
      return;
    b(e.a());
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.paypal.android.MEP.b.h
 * JD-Core Version:    0.6.2
 */